package com.genesis.yunnanji.adapter;

import android.content.Context;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.genesis.yunnanji.R;
import com.genesis.yunnanji.bean.HouseTypeBean;
import com.genesis.yunnanji.config.GenesisApiConfig;
import com.lidroid.xutils.BitmapUtils;

import java.util.List;


public class HouseTypeAdapter extends BaseQuickAdapter<HouseTypeBean.ResultBean.ListBean, BaseViewHolder> {


    private Context context;

    public HouseTypeAdapter(Context context, @Nullable List<HouseTypeBean.ResultBean.ListBean> data) {
        super(R.layout.layout_housetype, data);
        this.context = context;
    }


    @Override
    protected void convert(BaseViewHolder helper, HouseTypeBean.ResultBean.ListBean item) {

        if (!TextUtils.isEmpty(item.getDesc())) {
            helper.setText(R.id.tv_housetype_describle, item.getDesc());
        } else {
            helper.getView(R.id.tv_housetype_describle).setVisibility(View.GONE);
        }
        BitmapUtils bitmapUtils = new BitmapUtils(context);
        bitmapUtils.display((ImageView) helper.getView(R.id.iv_housetype_image), GenesisApiConfig.PIC_HOST + item.getPicture_img());
    }
}
